﻿using Autodesk.Windows;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;

namespace HaierCADplug_in.ViewModel
{
    public class RibbonButtonEX:RibbonButton
    {
        //按钮上要显示的图标
        private string imgFileName = "";
        public string ImgFileName { get => imgFileName; set => imgFileName = value; }
        
        //鼠标进入时的图标
        private string imgHoverFileName = "";
        public string ImgHoverFileName { get => imgHoverFileName; set => imgHoverFileName = value; }


        //按钮提示信息

        public RibbonButtonEX(string name) : base()
        {
            this.Name = name;//按钮名称
            this.Text = name;//按钮文字
            this.ShowText = true;//显示文字
            this.Size = RibbonItemSize.Large;//按钮尺寸
            this.Orientation = System.Windows.Controls.Orientation.Vertical;//按钮排列方式
            this.ShowImage = true;
            //this.IsEnabled=false;

            //按钮事件
            this.MouseEntered += this_MouseEntered;
            this.MouseLeft += this_MouseLeft;
            
        }
        /// <summary>
        /// 图标名称
        /// </summary>
        /// <param name="filename">图标名称，带扩展名</param>
        public void SetImage(string filename)
        {
            string pt = Path.GetDirectoryName(this.GetType().Assembly.Location) + "\\icons\\";
            string imgFileName = pt + filename;
            Uri uri = new Uri(imgFileName);
            BitmapImage bitmapImage = new BitmapImage(uri);
            this.LargeImage = bitmapImage;
        }

       /// <summary>
       /// 鼠标离开时的事件
       /// </summary>
       /// <param name="sender"></param>
       /// <param name="e"></param>
        private void this_MouseLeft(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// 鼠标进入时的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void this_MouseEntered(object sender, EventArgs e)
        {

        }
    }
}
